/*=====================================================
Critical Links
Auto Configuration Server

Authors:
	Rui Eduardo Gouveia Gil - r-gil@critical-links.com

Date: 2011
Version 0.1
=======================================================*/
Log = function(xml) {
	var xmlDoc = parseXML(xml);

	this.type = 'c';
	this.id = xmlDoc.getElementsByTagName("ID")[0].childNodes[0].nodeValue;
	this.date = xmlDoc.getElementsByTagName("Date")[0].childNodes[0].nodeValue;
	this.dateStr = xmlDoc.getElementsByTagName("DateStr")[0].childNodes[0].nodeValue;
	this.deviceID = xmlDoc.getElementsByTagName("DeviceID")[0].childNodes[0].nodeValue;
	this.deviceName = xmlDoc.getElementsByTagName("DeviceName")[0].childNodes[0].nodeValue;
	this.level = xmlDoc.getElementsByTagName("LogLevel")[0].childNodes[0].nodeValue;
	this.levelStr = xmlDoc.getElementsByTagName("LogLevelStr")[0].childNodes[0].nodeValue;
	this.levelIcon = xmlDoc.getElementsByTagName("LogLevelIcon")[0].childNodes[0].nodeValue;
	this.ip = xmlDoc.getElementsByTagName("Ip")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Name").length != 0 && xmlDoc.getElementsByTagName("Name")[0].childNodes.length != 0)
		this.name = xmlDoc.getElementsByTagName("Name")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("License").length != 0 && xmlDoc.getElementsByTagName("License")[0].childNodes.length != 0)
		this.license = xmlDoc.getElementsByTagName("License")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Release").length != 0 && xmlDoc.getElementsByTagName("Release")[0].childNodes.length != 0)
		this.release = xmlDoc.getElementsByTagName("Release")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Customer").length != 0 && xmlDoc.getElementsByTagName("Customer")[0].childNodes.length != 0)
		this.customer = xmlDoc.getElementsByTagName("Customer")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Command").length != 0 && xmlDoc.getElementsByTagName("Command")[0].childNodes.length != 0)
		this.command = xmlDoc.getElementsByTagName("Command")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Result").length != 0 && xmlDoc.getElementsByTagName("Result")[0].childNodes.length != 0)
		this.result = xmlDoc.getElementsByTagName("Result")[0].childNodes[0].nodeValue;
	if(xmlDoc.getElementsByTagName("Message").length != 0 && xmlDoc.getElementsByTagName("Message")[0].childNodes.length != 0)
		this.message = xmlDoc.getElementsByTagName("Message")[0].childNodes[0].nodeValue;
};

Ext.reg('applog', Log);